<html>
<head>
<meta charset="UTF-8">
<title>Entity - KBEngine bots</title>
<link href="../../style.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td align=left style="background:#708090"> <font size=15 color=#ffffff> KBEngine </font></td></tr>
</table> <hr>
<h1>Entity class</h1>

<p style="text-align: center;"><span class="module_h1">[<a href="../Modules/KBEngine.html" class="module_h1">KBEngine module</a>]</span></p>
<p>Entity is part of the <a href="../Modules/KBEngine.html">KBEngine</a> module. 
<a href="#detailed_description">More...</a></p><p></p><pre>import KBEngine</pre>

<h2><a href="#" onClick="obj=document.getElementById( 'functions' );vis = (obj.style.display == 'none') ? 'block' : 'none'; obj.style.display = vis; return false;" class="h2">Member functions</a></h2>
<table id="functions" cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr><td>
<span class="function_list">def <a href="#moveToPoint" class="function_list" >moveToPoint</a>( self, destination, velocity, distance, userData, faceMovement, moveVertically ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#cancelController" class="function_list" >cancelController</a>( self, controllerID ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#isPlayer" class="function_list" >isPlayer</a>( self ):</span>
</td></tr>

<tr><td>
    <span class="function_list">def <a href="#getComponent" class="function_list" >getComponent</a>( self, componentName, all ):</span>
</td></tr>

<tr><td>
    <span class="function_list">def <a href="#fireEvent" class="function_list" >fireEvent</a>( self, eventName, *args ):</span>
</td></tr>

<tr><td>
    <span class="function_list">def <a href="#registerEvent" class="function_list" >registerEvent</a>( self, eventName, callback ):</span>
</td></tr>

<tr><td>
    <span class="function_list">def <a href="#deregisterEvent" class="function_list" >deregisterEvent</a>( self, eventName, callback ):</span>
</td></tr>

</table>

<h2><a href="#" onClick="obj=document.getElementById( 'callbacks' );vis = (obj.style.display == 'none') ? 'block' : 'none'; obj.style.display = vis; return false;" class="h2">Callbacks</a></h2>
<table id="callbacks" cellpadding=0 cellspacing=3 style="margin-left: 20px;">


<tr><td>
<span class="function_list">def <a href="#onEnterWorld" class="function_list" >onEnterWorld</a>( self ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#onLeaveWorld" class="function_list" >onLeaveWorld</a>( self ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#onEnterSpace" class="function_list" >onEnterSpace</a>( self ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#onLeaveSpace" class="function_list" >onLeaveSpace</a>( self ):</span>
</td></tr>
</table>

<h2><a href="#" onClick="obj=document.getElementById( 'attributes' );vis = (obj.style.display == 'none') ? 'block' : 'none'; obj.style.display = vis; return false;" class="h2">Attributes</a></h2>
<table id="attributes" cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><a href="#base" class="attribute_list" >base</a></td><td>&nbsp; Read-only <a href=../../keywords.html#EntityCall>ENTITYCALL</a>
</td></tr>

<tr valign=top><td><a href="#client" class="attribute_list" >cell</a></td><td>&nbsp; Read-only <a href=../../keywords.html#EntityCall>ENTITYCALL</a>
</td></tr>

<tr valign=top><td><a href="#className" class="attribute_list" >className</a></td><td>&nbsp; Read-only <a href="STRING.html">string</a>
</td></tr>

<tr valign=top><td><a href="#clientapp" class="attribute_list" >clientapp</a></td><td>&nbsp; Read-only <a href="../Classes/PyClientApp.html">PyClientApp</a>
</td></tr>

<tr valign=top><td><a href="#direction" class="attribute_list" >direction</a></td><td>&nbsp; Tuple of 3 floats as (roll, pitch, yaw)
</td></tr>

<tr valign=top><td><a href="#id" class="attribute_list" >id</a></td><td>&nbsp; Read-only Integer
</td></tr>

<tr valign=top><td><a href="#position" class="attribute_list" >position</a></td><td>&nbsp; <a href=../../keywords.html#vector3>Vector3</a>
</td></tr>

<tr valign=top><td><a href="#spaceID" class="attribute_list" >spaceID</a></td><td>&nbsp; Read-only uint32
</td></tr>

<tr valign=top><td><a href="#isOnGround" class="attribute_list" >isOnGround</a></td><td>&nbsp; Read-only bool
</td></tr>

</table>

<hr>
<a name="detailed_description"></a><h2>A detailed description</h2>
Instances of the class <a href=../../keywords.html#entity>Entity</a> 
represent game objects on the client.
<br><br>

<br><br>
An <a href=../../keywords.html#entity>Entity</a> can access its equivalent 
entities in the base and cell applications via <a href=../../keywords.html#EntityCall>ENTITYCALL</a>. 
This requires a set of remotely-invoked functions (specified in the entity's 
.def file).

<hr>
<h2>Member functions documentation</h2>

<a name="moveToPoint"></a><p class="function_definition">
<span class="function_definition">def moveToPoint( <i>self, destination, velocity, distance, userData, faceMovement, moveVertically</i> ):</span>
</p>

<div class="function_description">
<b>Function description:</b><br><br>
Moves the <a href=../../keywords.html#entity>Entity</a> to the given 
coordinate point in a straight line. The callback will be called on 
success or failure.<br>
Any <a href="Entity.html">Entity</a> can only have one motion controller 
at any time. Repeatedly calling any move function will terminate the 
previous move controller.<br>
Returns a controller ID that can be used to cancel this move.

<br><br>Example:
<br>You can use <a href=../../keywords.html#entity>Entity</a>.<a href=Entity.html#cancelController>cancelController</a>( movementID ) or 
<a href=../../keywords.html#entity>Entity</a>.<a href=Entity.html#cancelController>cancelController</a>( "Movement" ) 
to cancel the move. The callback will not be called if the move is cancelled.
<br><br>
The callback functions are defined as follows:

<pre>	def onMove( self, controllerID, userData ):
	def onMoveOver( self, controllerID, userData ):
	def onMoveFailure( self, controllerID, userData ):
</pre>
</div>

<p>
<span class="function_links"><b>See also:</b></span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td><a href=../../keywords.html#entity>Entity</a>.<a href="Entity.html#cancelController">cancelController</a><br></td></tr>
</table>
</p>

<p>
<span class="function_parameter">parameters:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><span class="function_parameter_name"><i>destination</i></span></td><td><span class="function_parameter_description">
Vector3, the target point to which the <a href=../../keywords.html#entity>Entity</a> 
is to be moved.</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>velocity</i></span></td><td><span class="function_parameter_description">
float, the speed to move the <a href=../../keywords.html#entity>Entity</a> (in m/s).</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>distance</i></span></td><td><span class="function_parameter_description">
float, the distance target which if it is within, movement is stopped. 
If the value is 0, it moves to the target position.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>userData</i></span></td><td><span class="function_parameter_description">
object, user data passed to the callback function.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>faceMovement</i></span></td><td><span class="function_parameter_description">
bool, True if the entity faces the direction of the move. If it is other mechanism, it is False.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>moveVertically</i></span></td><td><span class="function_parameter_description">
bool, set to True means to move in a straight line directly to the point, 
and False means to move in a straight line paralell to the ground.
</span></td></tr>

</table>
</p>

<p>
<span class="function_return">returns:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td>
int, newly created controller ID.
</td></tr>
</table>
</p>



<a name="cancelController"></a><p class="function_definition">
<span class="function_definition">def cancelController( <i>self, controllerID</i> ):</span>
</p>

<div class="function_description">
<b>Function description:</b><br><br>
The cancelController function stops the effect of a controller on the <a href=../../keywords.html#entity>Entity</a>.
It can only be called on a <a href=../../keywords.html#real>real</a> entity.
</div>

<p>
<span class="function_parameter">parameters:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><span class="function_parameter_name"><i>controllerID</i></span></td><td><span class="function_parameter_description">
integer, the index of the controller to cancel. A special controller type 
string can also be used. For example, only one movement/navigation controller 
can be activated at a time. This can be cancelled with entity.cancelController("Movement").
</span></td></tr>

</table>
</p>

<a name="isPlayer"></a><p class="function_definition">
<span class="function_definition">def isPlayer( <i>self</i> ):</span>
</p>

<div class="function_description">
<b>Function description:</b><br><br>
This function returns whether the <a href=../../keywords.html#entity>Entity</a>
is the player controlled by the current client.
</div>

<p>
<span class="function_return">returns:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td>bool, If the player controlled by the current client returns true, otherwise it returns false.
</td></tr>
</table>
</p>


<a name="getComponent"></a><p class="function_definition">
<span class="function_definition">def getComponent( <i>self, componentName, all</i> ):</span>
</p>

<div class="function_description">
<b>Function description:</b><br><br>
Gets a component instance of the specified type attached to the entity.
</div>

<p>
<span class="function_parameter">parameters:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><span class="function_parameter_name"><i>componentName</i></span></td><td><span class="function_parameter_description">
string, The component type name.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>all</i></span></td><td><span class="function_parameter_description">
bool, if True, Returns all instances of the same type of component, otherwise only returns the first or empty list.
</span></td></tr>
</table>
</p>


<a name="fireEvent"></a><p class="function_definition">
<span class="function_definition">def fireEvent( <i>self, eventName, *args</i> ):</span>
</p>

<div class="function_description">
<b>Function description:</b><br><br>
Trigger entity events.
</div>

<p>
<span class="function_parameter">parameters:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><span class="function_parameter_name"><i>eventName</i></span></td><td><span class="function_parameter_description">
string, the name of the event to trigger.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>args</i></span></td><td><span class="function_parameter_description">
The event datas to be attached, variable parameters.
</span></td></tr>
</table>
</p>


<a name="registerEvent"></a><p class="function_definition">
<span class="function_definition">def registerEvent( <i>self, eventName, callback</i> ):</span>
</p>

<div class="function_description">
<b>Function description:</b><br><br>
Register entity events.
</div>

<p>
<span class="function_parameter">parameters:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><span class="function_parameter_name"><i>eventName</i></span></td><td><span class="function_parameter_description">
string, the name of the event to be registered for listening.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>callback</i></span></td><td><span class="function_parameter_description">
The callback method used to respond to the event when the event fires.
</span></td></tr>
</table>
</p>


<a name="deregisterEvent"></a><p class="function_definition">
<span class="function_definition">def deregisterEvent( <i>self, eventName, callback</i> ):</span>
</p>

<div class="function_description">
<b>Function description:</b><br><br>
Deregister entity events.
</div>

<p>
<span class="function_parameter">parameters:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><span class="function_parameter_name"><i>eventName</i></span></td><td><span class="function_parameter_description">
string, the name of the event to be deregister.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>callback</i></span></td><td><span class="function_parameter_description">
The callback method to deregister of the listener.
</span></td></tr>
</table>
</p>


<hr>
<h2>Callback functions documentation</h2>





<a name="onEnterWorld"></a><p class="function_definition">
<span class="function_definition">def onEnterWorld( <i>self</i> ):</span>
</p>

<div class="function_description">If the entity is not a client-controlled 
entity, it indicates that the entity has entered the View scope of the 
entity controlled by the client on the server side. At this time, the 
client can see this entity. <br>
If the entity is a client-controlled entity, it indicates that the entity 
has created a cell on the server and entered space.
</div>



<a name="onLeaveWorld"></a><p class="function_definition">
<span class="function_definition">def onLeaveWorld( <i>self</i> ):</span>
</p>

<div class="function_description">If the entity is not a client-side 
control entity, it indicates that the entity has left the view scope of 
the client-controlled entity on the server side, and the client cannot 
see this entity at this time. <br>
If the entity is a client-controlled entity, it indicates that the entity 
has destroyed the cell on the server and left space.
</div>



<a name="onEnterSpace"></a><p class="function_definition">
<span class="function_definition">def onEnterSpace( <i>self</i> ):</span>
</p>

<div class="function_description">The client-controlled entity enters a 
new space.
</div>



<a name="onLeaveSpace"></a><p class="function_definition">
<span class="function_definition">def onLeaveSpace( <i>self</i> ):</span>
</p>

<div class="function_description">The client-controlled entity leaves the 
current space.
</div>



<hr>
<h2>Attributes documentation</h2>

<a name="base"></a><p class="attribute_definition">
<span class="attribute_definition">base</span>
</p>

<div class="attribute_description">base is the entityCall used to contact 
the base <a href=../../baseapp/classes/Entity.html>Entity</a>. This attribute 
is read-only, and is None if this entity does not have an associated base <a href=../../baseapp/classes/Entity.html>Entity</a>.
</div>

<p>
<span class="attribute_links"><b>Other references:</b></span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td><a href=../../keywords.html#entity>Entity</a>.<a href="Entity.html#clientEntity">clientEntity</a><br><a href=../../keywords.html#entity>Entity</a>.<a href="Entity.html#allClients">allClients</a><br><a href=../../keywords.html#entity>Entity</a>.<a href="Entity.html#otherClients">otherClients</a><br></td></tr>
</table>
</p>

<p>
<span class="attribute_type">Types:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td>Read-only, <a href=../../keywords.html#EntityCall>ENTITYCALL</a>
</td></tr>
</table>
</p>


<a name="cell"></a><p class="attribute_definition">
<span class="attribute_definition">cell</span>
</p>

<div class="attribute_description">
<b>Description:</b><br><br>
cell is the <a href=../../keywords.html#EntityCall>ENTITYCALL</a> used to 
contact the cell entity. This attribute is Read-only, and is None if the 
base entity has no associated cell.
<br><br>
</div>

<p>
<span class="attribute_type">Types:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td>Read-only <a href=../../keywords.html#EntityCall>ENTITYCALL</a>
</td></tr>
</table>
</p>

<a name="cellData"></a><p class="attribute_definition">
<span class="attribute_definition">cellData</span>
</p>

<div class="attribute_description">
<b>Description:</b><br><br>
cellData is a dictionary property. Whenever the base entity has not created 
its cell entity, the attributes of the cell entity are stored here.
<br><br>
If the cell entity is created, the values and <a href=#cellData>cellData</a> 
attributes will be deleted. In addition to the attributes that the cell 
entity specifies in the entity definition file, it also contains position, 
direction, and spaceID.
</div>

<p>
<span class="attribute_type">Types:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td><a href="CELLDATADICT.html">CELLDATADICT</a>
</td></tr>
</table>
</p>

<a name="className"></a><p class="attribute_definition">
<span class="attribute_definition">className</span>
</p>

<div class="attribute_description">
<b>Description:</b><br><br>
The class name of the entity.
</div>

<p>
<span class="attribute_type">Types:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td>Read-only, string
</td></tr>
</table>
</p>

<a name="clientapp"></a><p class="attribute_definition">
<span class="attribute_definition">clientapp</span>
</p>

<div class="attribute_description">
<b>Description:</b><br><br>
The client (object) to which the current entity belongs.
</div>

<p>
<span class="attribute_type">Types:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td>Read-only, <a href="../Classes/PyClientApp.html">PyClientApp</a>
</td></tr>
</table>
</p>

<a name="position"></a><p class="attribute_definition">
<span class="attribute_definition">position</span>
</p>

<div class="attribute_description">The coordinates (x, y, z) of this 
entity in world space. The data is synchronized from the server to the 
client.

<br><br>

</div>

<p>
<span class="attribute_type">Types:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td><a href=../../keywords.html#vector3>Vector3</a>
</td></tr>
</table>
</p>


<a name="direction"></a><p class="attribute_definition">
<span class="attribute_definition">direction</span>
</p>

<div class="attribute_description">This attribute describes the orientation 
of the <a href=../../keywords.html#entity>Entity</a> in world space. Data 
is synchronized from the server to the client.
</div>

<p>
<span class="attribute_type">Types:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td>Vector3, which contains (roll, pitch, yaw) in radians.
</td></tr>
</table>
</p>


<a name="isOnGround"></a><p class="attribute_definition">
<span class="attribute_definition">isOnGround</span>
</p>

<div class="attribute_description">If the value of this attribute is True, 
the <a href=../../keywords.html#entity>Entity</a> is on the ground, otherwise 
it is False.<br>
If it is a client-controlled entity, this attribute will be synchronizd 
to the server at the time of change, and other entities will be synchronized 
to the client by the server. The client can determine this value to reduce 
the cost of accuracy.
</div>

<p>
<span class="attribute_type">Types:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td>Read-write, bool
</td></tr>
</table>
</p>



<hr>
<p class="copyrightFooter">Copyright KBEngine</p>
</body>
</html>
